<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>找回密码 <!--{$site.title}-->_<!--{$site.seotitle}--></title>
    <meta name="keywords" content="<!--{$site.keywords}-->" />
    <meta name="description" content="<!--{$site.description}-->"/>
    <meta name="mobile-agent" content="format=html5;url=<!--{$site.url}-->"/>
    <!--{iCMS:public:ui}-->
    <link rel="stylesheet" href="<!--{$site.urls.ui}-->/iCMS.loginreg-6.0.0.css" type="text/css" />
    <script>
    $(function(){
      $("#iCMS_findpwd").click(function(event) {
        var uname = $('input[name="uname"]').val();
        if (!uname) {
          $('input[name="uname"]').focus();
          iCMS.alert("请填写您注册时所用的邮箱！");
          return false;
        }
        var pattern = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9._-])+/;
        if (!pattern.test(uname)) {
          $('input[name="uname"]').focus();
          iCMS.alert("电子邮箱格式不正确！");
          return false;
        }
        var seccode = $('input[name="seccode"]').val();
        if (!seccode) {
          $('input[name="seccode"]').focus();
          iCMS.alert("请填写验证码！");
          return false;
        }
        $.get(iCMS.api('user',"&do=check"), {name:'username',value: uname},
          function(c) {
            if (c.code) {
              $("#iCMS_seccode_img").click();
              iCMS.alert("您输入的邮箱不存在！请重新输入.");
            }else{
              var param = {'action':'findpwd','uname':uname,'seccode':seccode}
              $.post(iCMS.api('user'), param, function(ret) {
                iCMS.alert(ret.msg);
              }, 'json');
            }
          }, 'json');

      });
    })
    </script>
  </head>
  <body class="iCMS_findpwd_wrap">
    <div class="findpwd_wrap">
      <div class="logo"> <a href="<!--{$site.url}-->" class="iCMS fl" title="<!--{$site.title}-->"><!--{$site.title}--></a> </div>
      <div class="content">
        <div class="main-col">
          <h1>找回密码</h1>
          <div class="rl_center">
            <div id="iCMS-findpwd-page" class="rl_form">
              <div class="lg_name" style="margin-left: 50px;"> <span>邮箱：</span>
                <input type="text" placeholder="请填写你注册时所用的邮箱" name="uname" class="iCMS_findpwd_uname text">
              </div>
              <div class="err_uname"><span><i class="fa fa-minus-circle"></i> 请输入登录名</span></div>
              <div class="clear"></div>
              <div class="lg_check"><span>验证码：</span>
                <input type="text" maxlength="4" name="seccode" class="iCMS_findpwd_seccode iCMS_seccode">
                <img src="<!--{iCMS:router url='/api/public/seccode'}-->" alt="验证码" class="iCMS_seccode_img r3"/>
                <a href="javascript:;" class="iCMS_seccode_text" style="float: none">换一张</a>
              </div>
              <div class="err_seccode"><span><i class="fa fa-minus-circle"></i> 请输入验证码</span></div>
              <div class="clear"></div>
              <button class="btn btn-large btn-primary" id="iCMS_findpwd" type="button">提 交</button>
            </div>
          </div>
        </div>
        <div class="clearfix"></div>
      </div>
    </div>
    <!--{include file="{iTPL}/footer.htm"}-->
  </body>
</html>
